using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.Data.OleDb;

namespace TaskLogger
{
    public static class DataManager
    {
        private static TimeTrackerData timeTrackerData;

        public static TimeTrackerData TimeTrackerData
        {
            get
            {
                if (timeTrackerData == null)
                {
                    timeTrackerData = new TimeTrackerData();

                    if (File.Exists(DataFilePath))
                        timeTrackerData.ReadXml(DataFilePath);
                }
                return timeTrackerData;
            }
        }

        private static string DataFilePath
        {
            get { return Path.GetDirectoryName(Application.ExecutablePath) + "\\TimeTrackerData.xml";}
        }

        public static void SaveData()
        {
            TimeTrackerData.WriteXml(DataFilePath);
        }

    }
}
